## Uses shell-fm and a custom music script (music.py) to control a last.fm music stream
## Get shell-fm from http://nex.scrapping.cc/code/shell-fm/
# Detects /love /skip /ban

### music.py

##        ### Simple shell-fm control script
##        import commands, sys
##
##        ## Shell program
##        # Example: shell = "/bin/bash"
##        shell = "/usr/bin/fish"
##
##        processes = commands.getoutput('pgrep shell-fm').split('\n')[1:]
##        if len(processes) > 0:
##            sys.argv.append('bla')
##            if sys.argv[1] == "play":
##                artist = commands.getoutput("""zenity --entry --title="Artist" --text="Enter an Artist" """).replace(' ','+')
##                if artist == "":
##                    sys.exit()
##                else:  
##                    command = "echo play lastfm://artist/%s/similarartists | telnet localhost 54311"%artist.split('\n')[-1]
##                    commands.getoutput(command)
##            elif sys.argv[1] == "pp":
##                commands.getoutput('echo pause | telnet localhost 54311')
##            else:
##                commands.getoutput('echo %s | telnet localhost 54311'%sys.argv[1])
##        else:
##            artist = commands.getoutput("""zenity --entry --title="Artist" --text="Enter an Artist" | sed 's/ /+/'""")
##            command = "%s -c 'shell-fm -i localhost lastfm://artist/%s/similarartists'"%(shell,artist.split('\n')[-1])
##            commands.getoutput(command)
##

import tremcs
tremcs.InGameFunctions().RunCommand(['default'],{'love':'python music.py love','skip':'python music.py skip','ban':'python music.py ban'},1,debug=True)
